﻿@model Occupie.Models.Project

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

@using (Ajax.BeginForm("AddProject", new AjaxOptions
                        {
                            HttpMethod = "POST",
                            InsertionMode = InsertionMode.Replace,
                            UpdateTargetId = "edit-exp",
                            OnSuccess = "onSuccessProject"
                        }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)


        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            <br />
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-multiline-field">
            @Html.EditorFor(model => model.Description)
            <br />
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Link)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Link)
            <br />
            @Html.ValidationMessageFor(model => model.Link)
        </div>

        <p>
            <input id="add" type="submit" value="Добави" />
            <input type="button" id="cancelAdd" value="Отказ" onclick="closeProjectDialog()" />
        </p>
    
    <script>

        function onSuccessProject(ok, status, response) {
            closeProjectDialog();
        }


        function closeProjectDialog()
        {
            $("#projectDialog").dialog("close");
        }
    </script>
}
